package com.kexin.common.utils;


import com.kexin.common.user.entity.UserBase;
import com.kexin.common.user.service.IUserBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * @author chen
 * @date 2020/4/13
 */
@Component
public class UserUtils {
    private static IUserBaseService userBaseService;
    @Autowired
	public void setUserBaseService(IUserBaseService userBaseService){
		UserUtils.userBaseService = userBaseService;
	}

	public static UserBase getCurrentUser() {
		UserBase userBase=userBaseService.getCurrentUser();
		return userBase;
	}

	public static Integer getUserId() {

		return getCurrentUser().getId();
	}

	public static boolean isLogin() {
		return userBaseService.isLogin();
	}

}
